home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-21 | 3.3 KB | 107 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: ODText.cpp
- // Release Version: $ 1.0d1 $
- //
- // Author: Anthone Burbidge
- // Creation Date: 3/28/94
- //
- // Copyright: © 1993, 1994 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef _ODTEXT_
- #include "ODText.h"
- #endif
-
- #ifndef _EMBEDRUN_
- #include "EmbedRun.h"
- #endif
-
- // ----- Framework Includes -----
-
- #ifndef FWGRDEF_H
- #include <FWGrDef.h>
- #endif
-
- //========================================================================================
- // CLASS COpenDocText
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // COpenDocText::COpenDocText
- //----------------------------------------------------------------------------------------
-
- COpenDocText::COpenDocText()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // COpenDocText::~COpenDocText
- //----------------------------------------------------------------------------------------
-
- COpenDocText::~COpenDocText()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // COpenDocText::COpenDocText
- //----------------------------------------------------------------------------------------
-
- OSErr COpenDocText::InitOpenDocText(GrafPtr textPort,
- TTextensionHandlers* handlers,
- TSize sizeInfo)
- {
- return CTextension::ITextension(textPort, handlers, sizeInfo);
- }
-
- //----------------------------------------------------------------------------------------
- // COpenDocText::NotifyEmbeddedPartsOfPositionChange
- //----------------------------------------------------------------------------------------
-
- void COpenDocText::NotifyEmbeddedPartsOfPositionChange(long firstFormatLine,
- long lastFormatLine)
- {
- // ----- Notify embedded parts that their position may have changed
-
- long runLength;
- CRunObject* run;
-
- long lineStart = fFormatter->GetLineStart(firstFormatLine);
- CRunsRanges* runsRanges = this->GetRunsRanges();
-
- while (runsRanges->GetNextRun(lineStart, &run, &runLength) >= 0)
- {
- if (run->GetClassId() == kEmbeddedPartClassId)
- {
- FW_SPlatformPoint pt;
- short hite;
- long top, edge;
- short ascent, descent, leading;
-
- short selectionWidth = ((CEmbeddedRun *) run)->GetSelectionWidth();
-
- run->GetHiteInfo(&ascent, &descent, &leading);
- this->Char2Point(lineStart, &top, &edge, &hite);
- pt.v = (short) top + hite - (ascent + descent + leading) + selectionWidth;
- pt.h = (short) edge + selectionWidth;
-
- ((CEmbeddedRun *) run)->ChangePosition(pt);
- }
- lineStart += runLength;
- }
- }
-
- //----------------------------------------------------------------------------------------
- // COpenDocText::COpenDocText
- //----------------------------------------------------------------------------------------
-
- void COpenDocText::EndEdit(const TEditInfo* editInfo,
- long firstFormatLine, long lastFormatLine,
- TOffset* selOffset, Boolean updateKeyScript)
- {
- this->NotifyEmbeddedPartsOfPositionChange(firstFormatLine, lastFormatLine);
- CTextension::EndEdit(editInfo, firstFormatLine, lastFormatLine,
- selOffset, updateKeyScript);
- }
-